package top.eggcode.modules.dict.store;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;
import top.eggcode.modules.dict.model.WordEntity;

import java.util.List;

/**
 * Title:
 * Description: TODO
 * Date: 2021/5/21 20:42
 *
 * @author JiaQi Ding
 * @version 1.0
 */
public interface WordRepository extends JpaRepositoryImplementation<WordEntity, String> {

    /**
     * 查询最大编号
     *
     * @param dictId 关联字典
     * @return 整数
     */
    @Query("select max(t.sequence) from WordEntity t where t.dictId = ?1")
    Integer selectMaxSequence(String dictId);

    /**
     * 查找
     *
     * @param dictId 字典id
     * @return 字典数据项
     */
    List<WordEntity> findByDictId(String dictId);

}
